import { orderParamsType, orderRefundApplyType, orderScoreType } from "@/types/orderTypes"
import request from "@/utils/request"
import qs from "qs"

// 订单列表
export const orderList = (params: orderParamsType) => {
  return request.post('/api/nest/order/list', qs.stringify(params))
}

// 删除订单
export const orderDelete = (params: { id: number }) => {
  return request.post(`/api/nest/order/delete/${params.id}`, qs.stringify(params))
}

// 完成用餐
export const orderComplete = (params: { id: number }) => {
  return request.post(`/api/nest/order/complete/${params.id}`, qs.stringify(params))
}

// 订单评价
export const orderScore = (params: orderScoreType) => {
  return request.post(`/api/nest/order/score`, qs.stringify(params))
}

// 查看评价
export const orderScoreView = (params: { orderId: number }) => {
  return request.post(`/api/nest/order/viewScore/${params.orderId}`, qs.stringify(params))
}

// 申请退款
export const orderRefundApply = (params: orderRefundApplyType) => {
  return request.post(`/api/nest/order/refund/apply`, qs.stringify(params))
}
